package com.dragon.flow.model.org;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * @program: flow
 * @description: 人员信息
 * @author: Bruce.Liu
 * @create: 2021-04-10 13:53
 **/
@Data
@EqualsAndHashCode()
//@TableName(value = "tbl_org_personal")
@TableName(value = "sys_user")
public class Personal implements Serializable {
    private static final long serialVersionUID = 2457177038657460957L;
    /**
     * 主键ID
     */
    @TableId(value = "user_id", type = IdType.AUTO)
    @ApiModelProperty(value = "主键id")
    private Integer id;

    @ApiModelProperty(value = "用户名")
    private String username;

    @ApiModelProperty(value = "密码")
    private String password;

    @JsonIgnore
    @ApiModelProperty(value = "随机盐")
    private String salt;

    @ApiModelProperty(value = "创建时间")
    private Date createTime;

    @ApiModelProperty(value = "修改时间")
    private Date updateTime;

    @TableLogic
    @ApiModelProperty(value = "删除标记,1:已删除,0:正常")
    private String delFlag;

    @ApiModelProperty(value = "锁定标记")
    private String lockFlag;

    @ApiModelProperty(value = "手机号")
    private String phone;

    @ApiModelProperty(value = "头像地址")
    private String avatar;

    @ApiModelProperty(value = "用户所属部门id")
    private String deptId;

    @ApiModelProperty(value = "用户所属部门全名称")
    private String deptName;

    @ApiModelProperty(value = "用户所属租户id")
    private Integer tenantId;

    @ApiModelProperty(value = "微信openid")
    private String wxOpenid;

    @ApiModelProperty(value = "微信小程序openid")
    private String miniOpenid;

    @ApiModelProperty(value = "QQ openid")
    private String qqOpenid;

    @ApiModelProperty(value = "码云唯一标识")
    private String giteeLogin;

    @ApiModelProperty(value = "开源中国唯一标识")
    private String oscId;

    @ApiModelProperty(value = "公司ID")
    private String companyId;

    @ApiModelProperty(value = "公司名称")
    private String companyName;

    @ApiModelProperty(value = "真实姓名")
    private String realName;

    @ApiModelProperty(value = "领导的工号")
    private String leaderCode;

    @TableField(exist = false)
    @ApiModelProperty(value = "领导名称")
    private String leaderName;

    //岗位编码
    private String positionCode;

    @TableField(exist = false)
    private String positionName;
    //职级编码
    private String jobGradeCode;

    @TableField(exist = false)
    private String jobGradeName;

    @TableField(exist = false)
    private String deptCode;

    @TableField(exist = false)
    private String companyCode;

    //人员拥有的角色列表
    @TableField(exist = false)
    private List<Role> roles;
    @TableField(exist = false)
    private List<String> companyIds;
    @TableField(exist = false)
    private List<String> deptIds;

    @TableField(exist = false)
    private String keyword;

    @ApiModelProperty(value = "手机号")
    @TableField(exist = false)
    private String mobile;

    @ApiModelProperty(value = "工号")
    @TableField(exist = false)
    private String code;

    @ApiModelProperty(value = "名称")
    @TableField(exist = false)
    private String name;

    @ApiModelProperty(value = "用户ID")
    private Integer userId;

    public Integer getId() {
        if(this.id == null){
            return userId;
        }
        return id;
    }
}
